﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LispInterpretor;

namespace UnitTests
{
    [TestClass]
    public class TestCond
    {
        [TestMethod]
        public void TestSingleItemCond()
        {
            Assert.AreEqual(true, Evaluator.Eval("(cond (True True))"));
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestNoTrueCondition()
        {
            Evaluator.Eval("(cond (False \"Moo\") (False 1) (False True))");
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestBadlyFormedCondition()
        {
            Evaluator.Eval("(cond (False \"Moo\" 3))");
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestConditionThatDoesntEvaluateToBool()
        {
            Evaluator.Eval("(cond (\"Test\" 3))");
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestCondWithoutAnySubExpressions()
        {
            Evaluator.Eval("(cond )");
        }
        
           
    }
}
